When unreffing the stream from a different thread, the close function
will schedule its cleanup asynchornously in the main thread.
We need to make sure the stream object stays alive for as long as
that hasn't happened, so ref() it.
Fixes #2003
g_signal_handlers_disconnect_by_func (priv->display,
gdk_x11_selection_output_stream_xevent,
stream);
+ g_object_unref (stream);
return G_SOURCE_REMOVE;
}
GCancellable *cancellable,
GError **error)
{
- g_main_context_invoke (NULL, gdk_x11_selection_output_stream_invoke_close, stream);
+ g_main_context_invoke (NULL, gdk_x11_selection_output_stream_invoke_close, g_object_ref (stream));
return TRUE;
}